/* 赛博朋克霓虹主题 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Orbitron', 'Arial', sans-serif;
}

body {
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    overflow: hidden;
    position: relative;
}

/* 背景霓虹网格 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* 霓虹光效 */
.neon-glow {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor;
}

.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.game-header {
    text-align: center;
    padding: 10px;
    border-bottom: 2px solid rgba(0, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 2rem;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.subtitle {
    color: #a0a0ff;
    font-size: 0.95rem;
    text-shadow: 0 0 10px #a0a0ff;
}

.game-main {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: 0;
}

.game-board-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.board-container {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.4),
        inset 0 0 30px rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1;
    max-height: calc(100vh - 180px);
}

#game-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    grid-gap: 10px;
    padding: 10px;
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 600px;
    aspect-ratio: 1;
}

.tile {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tile:hover::before {
    opacity: 1;
}

.tile:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px currentColor;
    z-index: 10;
}

.tile.selected {
    transform: scale(1.1);
    box-shadow: 
        0 0 0 4px #000,
        0 0 0 6px currentColor,
        0 0 20px currentColor;
    z-index: 20;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px #000, 0 0 0 6px currentColor, 0 0 20px currentColor; }
    50% { box-shadow: 0 0 0 4px #000, 0 0 0 6px currentColor, 0 0 40px currentColor; }
}

.tile .inner {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

.tile.matched {
    animation: explode 0.6s ease forwards;
}

@keyframes explode {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.7; }
    100% { transform: scale(0); opacity: 0; }
}

.tile.falling {
    transition: transform 0.4s ease;
    z-index: 5;
}

/* 霓虹颜色 */
.tile.color1 .inner { 
    background: linear-gradient(135deg, #ff0033, #ff3366);
    box-shadow: 0 0 20px #ff0033;
}
.tile.color2 .inner { 
    background: linear-gradient(135deg, #00ffff, #33ccff);
    box-shadow: 0 0 20px #00ffff;
}
.tile.color3 .inner { 
    background: linear-gradient(135deg, #ffff00, #ffcc00);
    box-shadow: 0 0 20px #ffff00;
}
.tile.color4 .inner { 
    background: linear-gradient(135deg, #00ff00, #33ff33);
    box-shadow: 0 0 20px #00ff00;
}
.tile.color5 .inner { 
    background: linear-gradient(135deg, #0066ff, #3399ff);
    box-shadow: 0 0 20px #0066ff;
}
.tile.color6 .inner { 
    background: linear-gradient(135deg, #9900ff, #cc66ff);
    box-shadow: 0 0 20px #9900ff;
}

.game-status {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    border: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.game-controls-section {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.stats-panel,
.controls-panel,
.instructions-panel {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

h2 {
    color: #00ffff;
    margin-bottom: 12px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 10px #00ffff;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0, 20, 40, 0.6);
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.stat-label {
    color: #a0a0ff;
    font-size: 0.9rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}

#time { color: #ffcc00; }
#moves { color: #ff3366; }
#combo { color: #00ff00; }

.buttons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.btn-cyber {
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #003366, #0066cc);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 255, 0.5);
}

.btn-cyber::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: rotate(45deg);
    transition: transform 0.5s;
}

.btn-cyber:hover::before {
    transform: rotate(45deg) translate(10px, 10px);
}

.btn-cyber:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 255, 255, 0.4);
}

#restart-btn {
    background: linear-gradient(45deg, #cc0000, #ff3366);
}

#hint-btn {
    background: linear-gradient(45deg, #ff9900, #ffcc00);
}

#sound-btn {
    background: linear-gradient(45deg, #009933, #00cc66);
}

.instructions-panel ul {
    list-style: none;
    padding-left: 0;
}

.instructions-panel li {
    padding: 8px 0;
    color: #a0a0ff;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px dashed rgba(0, 255, 255, 0.2);
}

.instructions-panel li:last-child {
    border-bottom: none;
}

.color-legend {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.color-legend h3 {
    color: #ff00ff;
    margin-bottom: 15px;
    text-shadow: 0 0 10px #ff00ff;
}

.colors-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 20, 40, 0.6);
    border-radius: 8px;
    transition: transform 0.3s;
}

.color-item:hover {
    transform: scale(1.05);
}

.color-sample {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 0 15px currentColor;
}

.neon-red { background: linear-gradient(135deg, #ff0033, #ff3366); }
.neon-cyan { background: linear-gradient(135deg, #00ffff, #33ccff); }
.neon-yellow { background: linear-gradient(135deg, #ffff00, #ffcc00); }
.neon-green { background: linear-gradient(135deg, #00ff00, #33ff33); }
.neon-blue { background: linear-gradient(135deg, #0066ff, #3399ff); }
.neon-purple { background: linear-gradient(135deg, #9900ff, #cc66ff); }

.game-footer {
    padding: 15px;
    display: flex;
    justify-content: center;
}

.combo-display {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 30px;
    border-radius: 50px;
    border: 2px solid #ffcc00;
    box-shadow: 0 0 30px #ffcc00;
    display: flex;
    align-items: center;
    gap: 15px;
    transform: scale(0);
    transition: transform 0.3s;
}

.combo-display.active {
    transform: scale(1);
}

.combo-display span {
    color: #ffcc00;
    font-size: 1.2rem;
    text-shadow: 0 0 10px #ffcc00;
}

#combo-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffcc00;
    text-shadow: 0 0 20px #ffcc00;
}

/* 响应式设计 */
@media (min-width: 1201px) {
    .game-main {
        flex-direction: row;
    }
    
    .game-board-section {
        flex: 0 0 auto;
    }
    
    .board-container {
        width: 600px;
        height: 600px;
    }
    
    #game-grid {
        max-width: 560px;
        max-height: 560px;
    }
    
    .game-controls-section {
        overflow-y: auto;
    }
}

@media (max-width: 1200px) {
    .game-main {
        flex-direction: column;
    }
    
    .game-board-section {
        flex: 0 0 auto;
    }
    
    .game-controls-section {
        min-width: 100%;
    }
    
    .colors-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
        gap: 10px;
    }
    
    .game-header {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .game-main {
        flex-direction: column;
        gap: 10px;
    }
    
    #game-grid {
        grid-template-columns: repeat(8, 1fr);
        grid-template-rows: repeat(8, 1fr);
        grid-gap: 6px;
        width: 100%;
        max-width: 400px;
        aspect-ratio: 1;
    }
    
    .tile {
        width: 100%;
        height: 100%;
    }
    
    .game-controls-section {
        min-width: 100%;
        gap: 10px;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .stats-panel,
    .controls-panel {
        flex: 1;
        min-width: calc(50% - 5px);
        padding: 12px;
    }
    
    .stats-panel h2,
    .controls-panel h2 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-item {
        padding: 8px;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .buttons-grid {
        gap: 10px;
    }
    
    .btn-cyber {
        padding: 12px;
        font-size: 0.95rem;
    }
    
    .instructions-panel,
    .color-legend {
        display: none;
    }
    
    .game-status {
        margin-top: 10px;
        padding: 10px;
        font-size: 1rem;
    }
}

@media (max-height: 700px) {
    h1 {
        font-size: 1.6rem;
    }
    
    .game-header {
        padding: 8px;
    }
    
    .game-main {
        gap: 10px;
    }
    
    #game-grid {
        max-width: 450px;
        max-height: 450px;
    }
}

/* 加载动画 */
@keyframes neonPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading {
    animation: neonPulse 1.5s infinite;
}